package com.wgts.wgts.mvp.view.activity.wgtsteam;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.wgts.wgts.R;
import com.wgts.wgts.control.recycleview.BaseLoadMoreAdapter;
import com.wgts.wgts.netmodle.resp.WgtsFansDetail;
import com.wgts.wgts.tools.MoHuGlide;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;

public class WgtsFansAdapter extends BaseLoadMoreAdapter<WgtsFansAdapter.WgtsFansViewHolder> {


    private Context context;

    private List<WgtsFansDetail> wgtsFansDetails;

    public WgtsFansAdapter(Context context, List<WgtsFansDetail> wgtsFansDetails) {
        super(context);
        this.context = context;
        this.wgtsFansDetails = wgtsFansDetails;
    }

    @Override
    public void onBindBodyViewHolder(@NonNull WgtsFansViewHolder viewHolder, int i) {
        viewHolder.tvUserName.setText(wgtsFansDetails.get(i).userNickName);
        viewHolder.tvTime.setText(wgtsFansDetails.get(i).userTime);
    }

    @NonNull
    @Override
    public WgtsFansViewHolder onCreateBodyViewHolder(@NonNull ViewGroup viewGroup, int i) {
        return new WgtsFansViewHolder(LayoutInflater.from(context).inflate(R.layout.wgts_recycle_view_item, viewGroup, false));
    }

    @Override
    public int getBodyItemCount() {
        return wgtsFansDetails.size();
    }

    @Override
    public int getBodyItemViewType(int position) {
        return 0;
    }

    public class WgtsFansViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.img_user_head)
        CircleImageView imgUserHead;
        @BindView(R.id.tv_user_name)
        TextView tvUserName;
        @BindView(R.id.tv_time)
        TextView tvTime;
        public WgtsFansViewHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
